﻿@{
    ViewData["Title"] = "安全管理平台";
    var list = ViewBag.Topics as List<TopicViewModel>;
    var user = ViewBag.User as ApplicationUser;
    var nodes = ViewBag.Nodes as List<TopicNodeViewModel>;
    var announcementList = ViewBag.AnnouncementList;
}
@model Topic
<div class="row">
    <div class="col-md-9 topics">
        <div id="sections" class="panel panel-default">
            @*<div class="panel-heading">
                公告
                <div style="float:right;">
                    <a asp-controller="topic" asp-action="index" asp-route-nodeId ="1">更多...</a>
                </div>
            </div>
            <div class="panel-body">
                <div>
                    @foreach (var item in announcementList)
                    {
                        <div class="title">
                            <a asp-controller="Topic" asp-action="Details" asp-route-id="@item.Id">
                                @(item.Top == 1 ? "[置顶]" : "")@item.Title
                            </a>
                        </div>
                        <div class="info">
                            发布于 @item.CreateTime.ToString("MM-dd HH:mm")
                        </div>
                    }
                </div>
            </div>*@
            @*<div style="height:20px;background-color:rgb(231,233,237)"></div>*@
            <div class="panel-heading">版块分类导航</div>
            <div class="panel-body">
                <div>
                    @foreach (var item in nodes.Where(r => r.ParentId == 0).OrderBy(r => r.Order))
                    {
                        if (item.Name == "公告")
                        {
                            continue;
                        }
                        <div style="border-bottom:1px solid #ddd;height:50px;line-height:50px;">
                            <label>@item.Name</label>
                        </div>
                        @foreach (var n in nodes.Where(r => r.ParentId == item.Id).OrderBy(r => r.Order))
                        {

                            <div class="topic">
                                <div class="avatar media-left">
                                    @{ string nodeImg = "/images/" + n.Image;}
                                    <a href="#"><img class="avatar-48" src="@(string.IsNullOrEmpty(n.Image) ? "/images/note.png" : nodeImg)" alt="96"></a>
                                </div>
                                <div class="media-body">
                                    <div class="title">
                                        <a asp-controller="Topic" asp-action="Index" asp-route-nodeId="@n.Id">
                                            @n.Name
                                        </a>
                                    </div>
                                    <div class="info">
                                        @n.Description
                                    </div>
                                </div>
                                <div class="count media-right">
                                    <a>@n.TopicCount</a>
                                </div>
                            </div>
                        }
                    }
                </div>
            </div>
        </div>
    </div>
    <div class="col-md-3">
        @Html.Partial("_SidebarPartial")
    </div>
</div>